<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>blob文件学习</title>
</head>
<body>
    <script>
        const blob = new Blob(["Hello World"], { type: "text/plain" });
const url = URL.createObjectURL(blob); // 生成临时URL

// 使用示例：创建可下载链接
const a = document.createElement('a');
a.href = url;
a.download = 'demo.txt';
a.click();

// 释放内存（重要！）
URL.revokeObjectURL(url);
    </script>
</body>
</html>